﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ThermalEquipmentDesign.Model;
using System.Windows.Input;
using ThermalEquipmentDesign.Model.Condenser.CoolAirR22;
using System.Windows;
using System.Windows.Controls;
using ThermalEquipmentDesign.Reference_Path.Condenser;
using ThermalEquipmentDesign.Reference_Path;


namespace ThermalEquipmentDesign.ViewModel.Condenser
{
    public class CoolAirR22ViewModel : ObservableObject
    {
        // Declare fields for binding
        #region fields for binding
        private CoolAirR22 ocoolAirR22 = new CoolAirR22();
        private CoolAirR22Result ocoolAirR22Result = new CoolAirR22Result();             
        private ICommand calculateCoolAirR22;
        private String stooltip = "Press F1 for Help";
        #endregion

        // Create properties for binding
        #region properties for binding
        public String sTooltip
        {
            get { return stooltip; }
            set { stooltip = value; }
        }

        public CoolAirR22 oCoolAirR22
        {
            get { return ocoolAirR22; }
            set
            {
                if (value != ocoolAirR22)
                {
                    ocoolAirR22 = value;
                    OnPropertyChanged("oCoolAirR22");                    
                }
            }
        }

        public CoolAirR22Result oCoolAirR22Result
        {
            get { return ocoolAirR22Result; }
            set {
                if (value != ocoolAirR22Result)
                {
                    ocoolAirR22Result = value;
                    OnPropertyChanged("oCoolAirR22Result");
                }          
            }
        }

        public ICommand CalculateCoolAirR22
        {
            get
            {
                if (calculateCoolAirR22 == null)
                {
                    calculateCoolAirR22 = new RelayCommand(
                        param => ImplementCalculationCoolAirR22()
                    );
                }
                return calculateCoolAirR22;
            }
        }
        #endregion

        /// <summary>
        /// Calculate design parameters for Air-Cooled Condenser
        /// </summary>
        public void ImplementCalculationCoolAirR22()
        {            
            CoolAirR22Model CoolAirR22Model = new CoolAirR22Model();
            ocoolAirR22Result = CoolAirR22Model.ImplementCalculation(ocoolAirR22);
        }
        //  Load Reference for the helping
        public void LoadReference(string sIndex)
        {                                    
            System.Windows.Forms.Help.ShowHelp(null, ReferencePath.ReferenceFile, System.Windows.Forms.HelpNavigator.KeywordIndex, CoolAirR22Reference.ResourceManager.GetString(sIndex));                        
        }

    }
}
    

